history.pushState({page : 'state1'},'state','#state1');
history.pushState({page : 'state2'},'state','#state2');
window.onpopstate = function(event) {
    if (event.state.page === 'state1') {
        WeixinJSBridge.call('closeWindow');
    }
}

